﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="B2B.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<h2>AdminUpdateMember</h2>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HEAD" runat="server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="main_content" runat="server">
    <script type="text/javascript">
        function Update(maTV) {
            var tinhtrang = document.getElementById("TinhTrang");
            var ma = document.getElementById("idThanhVien");
            var json = {
                id: ma.value,
                TinhTrang: tinhtrang.value
            };
            $.ajax({
                url: '/Admin/AdminUpdateMember',
                type: 'POST',
                contentType: 'application/json',
                dataType: 'json',
                data: JSON.stringify(json),
            });
            alert("Update success");
        }
    </script>
    <% var tv = (ThanhVien)ViewData["ThanhVien"]; %>
    <table style="width:100% ">
        <tr><th style="text-align: left; width: 189px; height: 30px">Name:</th> <td><%=tv.HoTen %></td>              <td rowspan="18"><img src="../Images/Product/<%=tv.HinhAnh %>"/></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Email:</th> <td><%=tv.Email %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Country:</th> <td><%=tv.TenQuocGia %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Province/State:</th> <td><%=tv.TenTinhThanh_Bang %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Name Company:</th> <td><%=tv.TenCongTy %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Phone:</th> <td style="height: 30px"><%=tv.SoDienThoai %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Company Address:</th> <td><%=tv.DiaChiCongTy %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Establish Year:</th> <td><%=tv.NamThanhLap %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Website:</th> <td><a href="http://<%=tv.Website %>"><%=tv.Website %></a></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Scale:</th> <td><%=tv.QuyMo %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Factory Address:</th> <td><%=tv.DiaChiNhaMay %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Factory Scale:</th> <td><%=tv.QuyMoNhaMay %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Introduct About Company:</th> <td><%=tv.GioiThieuVeCongTy %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Type Member:</th> <td><%=tv.TenLoaiThanhVien %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Status:</th> 
            <td>
                <select id="TinhTrang">
                    <% if(tv.TinhTrangThanhVien==0)
                        { %>
                            <option value ="0" selected>Blocked</option>
                            <option value ="1">Not Blocked</option>
                    <% }
                        else 
                        { %>
                            <option value ="0">Blocked</option>
                            <option value ="1" selected>Not Blocked</option>
                    <% } %>
                </select>
            </td>
        </tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">Begin Date:</th> <td><%=tv.NgayBatDau %></td></tr>
        <tr><th style="text-align: left; width: 189px; height: 30px">End Date:</th> <td><%=tv.NgayKetThuc %></td></tr>
        <tr>
            <td style="text-align: left; width: 189px; height: 30px"></td>
            <td>
                <input type="button" value="Update" onclick="Update()"/>
                <input type="hidden" id="idThanhVien" value="<%=tv.MaTV %>"/>
            </td>

        </tr>
    </table>
</asp:Content>
